<template>
  <div class="father">
    御剑乘风来,除魔天地间!=====father.vue===={{ Sonmsg }}
    <!--父组件向子组件传递数据,使用属性绑定的方式-->
    <SonSon
      :num1="num"
      :str="strtext"
      :flag="true"
      :shuzi.sync="content"
      @SonEvent="handleson"
      @changeFa="changeFa"
    ></SonSon>
  </div>
</template> 
<script>
/* 口诀：父组件向子组件传值：属性绑定，在父组件身上属性绑定 */
import SonSon from './son.vue'
export default {
  components: {
    SonSon
  },
  data () {
    return {
      num: 123,
      Sonmsg: '',
      strtext: '来自父组件的数据',
      content: '123456'
    }
  },
  methods: {
    handleson (msg) {
      console.log(msg);
      this.Sonmsg = msg
    },
    changeFa (newSonStr) {
      console.log(newSonStr);
      console.log();
      this.strtext = newSonStr
    }


  }
}
</script>
<style lang='less'  scoped>
.father {
  color: red;
}
</style>
